package com.woniuxy.dudugua.controller;

import com.woniuxy.dudugua.entity.Address;
import com.woniuxy.dudugua.entity.User;
import com.woniuxy.dudugua.service.AddressService;
import com.woniuxy.dudugua.util.Result;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("address")
public class AddressController {
    @Autowired
    private AddressService addressService;
    @RequestMapping("getdefaultaddress")
    public Result getDefaultAddress(){
        User user = (User) SecurityUtils.getSubject().getPrincipal();
        Address address = addressService.selectDefaultAddress(user.getId());
        return new Result("200","success",address,null);
    }
}
